package 每日一题OJ;

import java.util.Scanner;

/**
 * @author shy_black
 * @date 2019/3/21 22:14
 * @Description:
 * 输入：asdfas werasdfaswer
 * 输出：6
 */
public class 最长公共子字符串 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        char[] a = s1.toCharArray();
        char[] b = s2.toCharArray();
        int count = 0;
        for (
                int i = 0;
                i < a.length; i++) {
            for (int j = 0; j < b.length; j++) {
                int temp = 0;
                int x = i;
                int y = j;
                while (x < a.length && y < b.length && (a[x] == b[y])) {
                    x++;
                    y++;
                    temp++;
                }
                if (temp > count)
                    count = temp;
            }
        }
        System.out.print(count);
    }
}